-
Notifications
You must be signed in to change notification settings - Fork 131
[SWUtil] PropertyListItem: Clarify use of init overloads that take arra…
#679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jakepetroules
merged 1 commit into
swiftlang:main
from
xedin:address-property-list-ambiguity
Jul 28, 2025
Merged
[SWUtil] PropertyListItem: Clarify use of init overloads that take arra…
#679
jakepetroules
merged 1 commit into
swiftlang:main
from
xedin:address-property-list-ambiguity
Jul 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
@swift-ci please test |
init overloads that take arra…init overloads that take arra…
…array and dictionary
The original comment that these overloads can be removed was incorrect
because the existential of `PropertyListItemConvertible` doesn't self
conform. The overloads are still needed to support collections with
heterogeneous values but nothing else and so they should be disfavored.
Turns out that some of the expressions that used to take advantage
of these overloads only work due to the solver producing a valid
solution from the "diagnostic" mode.
For example:
```
public var propertyListItem: PropertyListItem {
return .init(entries
.sorted { $0.identifier < $1.identifier }
.map {
[
"bundle-id": .plString($0.identifier),
"tags": PropertyListItem($0.tags.sorted()),
"bundle-path": .plString($0.path.str),
]
})
}
```
This expression should have been ambiguous because it can match
both `.init(any ...)` and `.init([any ...])` overloads due to an
existential conversion that is bi-directional for the closure.
For `.init(any ...)`, result of the closure is going to be erased
to existential inside of the body of the `.map` closure and for
`.init([any ...])`, this erasure is going to happen outside but
both are equally valid.
6150fe3 to
28d59ad
Compare
Contributor
Author
|
@swift-ci please test |
Contributor
Author
|
@swift-ci please test Linux |
jakepetroules
approved these changes
Jul 28, 2025
Contributor
Author
|
@swift-ci please test Linux |
Collaborator
|
The Linux job is broken; you need to wait until #673 is merged to unblock the CI. |
Contributor
Author
|
Sounds good, there is no rush with this. |
neonichu
approved these changes
Jul 28, 2025
Collaborator
|
@swift-ci please test Linux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…y and dictionary
The original comment that these overloads can be removed was incorrect because the existential of
PropertyListItemConvertibledoesn't self conform. The overloads are still needed to support collections with heterogeneous values but nothing else and so they should be disfavored.Turns out that some of the expressions that used to take advantage of these overloads only work due to the solver producing a valid solution from the "diagnostic" mode.
For example:
This expression should have been ambiguous because it can match both
.init(any ...)and.init([any ...])overloads due to an existential conversion that is bi-directional for the closure.For
.init(any ...), result of the closure is going to be erased to existential inside of the body of the.mapclosure and for.init([any ...]), this erasure is going to happen outside but both are equally valid.